<!DOCTYPE html>
<html>
<head>
    <title>出库记录</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div>
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"></i-input>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>
</div>

<script>
    $(function () {
        $("#jqGrid").Grid({
            url: '../sparepartout/list?checkStatus=1',
            colModel: [
                {label: '出库仓库ID', name: 'outStoreId', index: 'OUT_STORE_ID', hidden: true},
                {label: '出库仓库', name: 'outStore', index: 'OUT_STORE', width: 80},
                {label: '出库单号', name: 'outCode', index: 'OUT_CODE', width: 80},
                {label: '备件编码', name: 'partCode', index: 'PART_CODE', width: 80},

                {label: '名称', name: 'name', index: 'NAME', width: 80},
                {label: '规格', name: 'spec', index: 'SPEC', width: 80},
                {label: '单位', name: 'partUnit', index: 'PART_UNIT', width: 80},
                {label: '仓库位置', name: 'cargoLocation', index: 'cargoLocation', width: 80},

                {label: '出库数量', name: 'outNum', index: 'OUT_NUM', width: 50},
                {label: '退库数量', name: 'backNum', index: 'BACK_NUM', width: 50},
                {label: '领用单位', name: 'useUnit', index: 'USE_UNIT', width: 80},
                {label: '领用人员', name: 'createUser', index: 'CREATE_USER', width: 80},
                // {label: '维修单号ID', name: 'repairNoId', index: 'REPAIR_NO_ID', width: 80},
                {label: '维修单号', name: 'repairNo', index: 'REPAIR_NO', width: 80},
                // {label: '领料单号ID', name: 'pickNoId', index: 'PICK_NO_ID', width: 80},
                {label: '领料单号', name: 'pickNo', index: 'PICK_NO', width: 80},
                // {label: '使用设备ID', name: 'useDevId', index: 'USE_DEV_ID', width: 80},
                {label: '使用设备码', name: 'useDevCode', index: 'USE_DEV_CODE', width: 80},
                {label: '使用设备', name: 'useDevName', index: 'USE_DEV_NAME', width: 80},
                {
                    label: '出库日期', name: 'outDate', index: 'OUT_DATE', width: 80, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd');
                    }
                },
                {name: 'relNum', hidden: true},
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                {label: 'postionId', name: 'postionId', index: 'postionId',  hidden: true},
                // {label: '备注', name: 'remark', index: 'REMARK', width: 80},
                // {label: '货位', name: 'cargoLocation', index: 'CARGO_LOCATION', width: 80},

                // {label: '审核时间', name: 'checkDate', index: 'CHECK_DATE', width: 80},
                // {label: '审核人', name: 'checkUser', index: 'CHECK_USER', width: 80},
                // {label: '修改时间', name: 'updateDate', index: 'UPDATE_DATE', width: 80},
                // {label: '修改人员', name: 'updateUser', index: 'UPDATE_USER', width: 80},
                // {label: '添加时间', name: 'createDate', index: 'CREATE_DATE', width: 80}
            ]
        });
    });

    let vm = new Vue({
        el: '#rrapp',
        data: {
            q: {
                name: ''
            }
        },
        methods: {
            query: function () {
                vm.reload();
            },
            reload: function (event) {
                vm.showList = true;
                let page = $("#jqGrid").jqGrid('getGridParam', 'page');
                $("#jqGrid").jqGrid('setGridParam', {
                    postData: {'name': vm.q.name},
                    page: page
                }).trigger("reloadGrid");
            },
            reloadSearch: function () {
                vm.q = {
                    name: ''
                };
                vm.reload();
            }
        }
    });

    var getSparePartOut = function () {
        let result = getSelectedRowData("#jqGrid");
        var id = result.id;
        if (id == null) {
            return false;
        } else {
            return result;
        }
    }
</script>
</body>
</html>
